package com.huang.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.huang.anno.ResponseResult;
import com.huang.entity.User;
import com.huang.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.logging.Logger;

/**
 * @author 黄自祥
 * @date 2022/05/03 12:54
 * @Description:
 */
@RestController
public class HelloController {

    @PreAuthorize("hasAuthority('hello')")
    @RequestMapping("/hello")
    public String sayHello(){
        return "hello";
    }

    @Autowired
    UserMapper userMapper;
    @ResponseResult
    @RequestMapping("/getUser")
    public List<User> getUser(User user){
        LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(User::getSex, user.getSex());
        List<User> users = userMapper.selectList(queryWrapper);
        new Thread().start();
//        Page<User> userPage = userMapper.selectPage(new Page<>(), );
        return users;
    }
}
